package jspservlet.servlet;

import java.io.IOException;
//import java.io.PrintWriter;
import java.util.ArrayList;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import jspservlet.dao.DeviceDAO;
import jspservlet.dao.impl.DeviceDAOImpl;
import jspservlet.vo.Lamp;
import jspservlet.vo.Connection;

public class ChangeLampColorServlet {
    public void doGet(HttpServletRequest req,HttpServletResponse res) 
    throws IOException,ServletException{
    }

    public void doPost(HttpServletRequest req,HttpServletResponse res) 
        throws IOException,ServletException{
        DeviceDAO dao = new DeviceDAOImpl();
        Lamp lamp = new Lamp();
        lamp.setDeviceid(req.getParameter("deviceid")); //输入设备id
        lamp.setGear(req.getParameter("state")); //输入档位
        lamp.setRed(Integer.parseInt(req.getParameter("red")));
        lamp.setGreen(Integer.parseInt(req.getParameter("green")));
        lamp.setBlue(Integer.parseInt(req.getParameter("blue")));

        try {
            int flag = dao.changeLampColor(lamp);
        } catch (Exception e) {
        e.printStackTrace();
        } 

    }
}
